<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><ui:insert name="title">Default Title</ui:insert></title>
        <h:outputStylesheet name="css/jsfcrud.css"/>
        <h:outputScript library="js" name="reg.js"/>
    </h:head>

    <h:body>
        <div id="upBar">
            <h:panelGroup id="login" rendered="#{!barController.isLogged(request.getUserPrincipal().getName())}" >
                <h:form id="mainButtons">
                    <div id="logBut">
                        <h:commandButton action="/login" value="Login" />
                    </div>
                    <div id="regBut" >
                        <h:commandButton action="/evento/List" value="Eventos" />
                    </div>
                    <div style="float: left;" onmouseover="showForm();" onmouseout="hideForm();" >
                        <h:commandButton value="Registar"/>
                        <span id="registerButtons" >
                            <h:commandButton action="/autor/Create.xhtml" value="Autor" />
                            <h:commandButton action="/editor/Create.xhtml" value="Editor" />
                            <h:commandButton action="/revisor/Create.xhtml" value="Revisor"/>
                        </span>
                    </div>
                </h:form>
            </h:panelGroup>
            <h:panelGroup id="logged" rendered="#{barController.isLogged(request.getUserPrincipal().getName())}">
                <h:form>
                    <div>
                        <h:outputLabel style="color: #DDDDDD;" value="#{barController.getPUNome(request.getUserPrincipal().getName())}" />
                    </div>
                    <div>
                        <h:commandButton action="#{utilizadorController.prepareEdit()}" value="Editar Conta" />
                        <h:commandButton action="#{barController.logout(session, request)}" value="Logout" />
                        <h:commandButton action="/evento/List" value="Eventos" rendered="#{barController.isLogged(request.getUserPrincipal().getName())}" />
                        <h:commandButton action="/submissao/List" value="Submissões" rendered="#{barController.isAutor()}" />
                        <h:commandButton action="/revisao/List" value="Revisões" rendered="#{barController.isRevisor()}" />
                    </div>
                </h:form>
            </h:panelGroup>
        </div>
        <div class="content">
            <h1>
                <ui:insert name="title">Default Title</ui:insert>
            </h1>
            <p>
                <ui:insert name="body">Default Body</ui:insert>
            </p>
        </div>
    </h:body>

</html>
